<template>
  <div class="NotForSaleEdit" v-if="form.type_no">
    <div class="NotForSaleEdit-one borderbottom">
      <div class="NotForSaleEdit-title">
        <div></div>
        <div>基础信息</div>
      </div>
      <div class="NotForSaleEdit-one-content">
        <div>
          <div class="" style="margin-right: 30px">
            款号：{{ form.type_no }}
          </div>
          <div class="" style="margin-right: 30px">
            品名：{{ form.type_name }}
          </div>
          <div
            class="NotForSaleEdit-one-content-items"
            style="margin-right: 30px"
          >
            成衣图：
            <el-image
              v-if="form.wear_image"
              style="width: 100px; height: 100px"
              :src="form.wear_image[0]"
              fit="contain"
              :preview-src-list="form.wear_image"
            ></el-image>
          </div>
        </div>
        <div>
          工艺师：
          <el-input v-model="form.add_user" placeholder="请输入工艺师" style="width:300px"></el-input>
          
        </div>
        <div>
          <el-radio v-model="form.is_gif" label="0">非赠品</el-radio>
          <el-radio v-model="form.is_gif" label="1">赠品</el-radio>
        </div>
        <div>
          <el-radio v-model="form.is_perform" label="0">非演出服</el-radio>
          <el-radio v-model="form.is_perform" label="1">演出服</el-radio>
        </div>
        <div>
          <el-radio v-model="form.is_shuixi" label="0">非水洗产品</el-radio>
          <el-radio v-model="form.is_shuixi" label="1">水洗产品</el-radio>
        </div>
      </div>
    </div>

    <div class="NotForSaleEdit-one borderbottom">
      <div class="NotForSaleEdit-title">
        <div></div>
        <div>生产缝制工艺要求</div>
        <!-- <i
          class="el-icon-circle-plus-outline pointer"
          style="color: #409eff; font-size: 24px; margin-left: 10px"
        ></i> -->
      </div>
      <div class="">
        <div style="display: flex; align-items: center">
          <div class="" style="width: 70px; margin-right: 10px">
            用针型号针距缝份
          </div>
          <el-input
            style="width: 100%"
            v-model="form.production_sewing_process_requirements.stitch"
            placeholder="请输入用针型号针距缝份"
            size="normal"
            clearable
            :rows="3"
            type="textarea"
          ></el-input>
        </div>
        <div style="display: flex; align-items: center; margin-top: 20px">
          <div class="" style="width: 70px; margin-right: 10px">粘衬部位</div>
          <el-input
            style="width: 100%"
            v-model="form.production_sewing_process_requirements.lining"
            placeholder="请输入粘衬部位"
            size="normal"
            type="textarea"
            :rows="3"
            clearable
          ></el-input>
        </div>
      </div>
    </div>
    <!-- <div class="NotForSaleEdit-one borderbottom">
      <div class="NotForSaleEdit-title">
        <div></div>
        <div>特别注意</div>
        <i
          class="el-icon-circle-plus-outline pointer"
          style="color: #409eff; font-size: 24px; margin-left: 10px"
          @click="onSpecial('particular_attention')"
        ></i>
      </div>
      <div class="">
        <div
          style="display: flex; align-items: center"
          v-for="(item, index) in form.particular_attention"
          :key="index"
        >
          <div class="" style="width: 80px; margin-right: 10px">
            注意事项{{ index + 1 }}
          </div>
          <el-input
            style="width: 100%; margin-right: 10px"
            v-model="item.content"
            placeholder="请输入注意事项"
            size="normal"
            clearable
          ></el-input>
          <el-upload
            class="avatar-uploader"
            action="https://ssy.13yu.com/index.php/Admin/Api/upload"
            :show-file-list="false"
            :on-success="
              (response) => {
                return handleSuccess(response, index);
              }
            "
          >
            <img
              v-if="item.url"
              :src="item.url"
              class="avatar"
              style="width: 60px; height: 60px"
            />
            <i
              v-else
              class="el-icon-plus avatar-uploader-icon"
              style="width: 60px; height: 60px; line-height: 60px !important"
            ></i>
          </el-upload>
          <i
            class="el-icon-delete pointer"
            style="font-size: 30px; color: red; margin-left: 10px"
            @click="onDelete(index, 'particular_attention')"
          ></i>
        </div>
      </div>
    </div> -->
    <div class="NotForSaleEdit-one borderbottom">
      <div class="NotForSaleEdit-title">
        <div></div>
        <div>工艺细节图</div>
      </div>
      <div class="NotForSaleEdit-one-content">
        <div>
          <div class="">上传图片：</div>
          <el-upload
            action="https://ssy.13yu.com/index.php/Admin/Api/upload"
            :on-success="handleSuccessXJ"
            :before-remove="handleRemovesXJ"
            list-type="picture-card"
            :file-list="form.detail_drawing"
          >
            <i slot="default" class="el-icon-plus"></i>
            <div slot="file" slot-scope="{ file }">
              <div class="fileimg">
                <img class="el-upload-list__item-thumbnail" :src="file.url" />
              </div>

              <span class="el-upload-list__item-actions">
                <span
                  class="el-upload-list__item-preview"
                  @click="handlePictureCardPreview(file)"
                >
                  <i class="el-icon-zoom-in"></i>
                </span>
                <span
                  v-if="!disabled"
                  class="el-upload-list__item-delete"
                  @click="handleRemovesXJ(file)"
                >
                  <i class="el-icon-delete"></i>
                </span>
              </span>
            </div>
          </el-upload>
        </div>
      </div>
    </div>
    <div class="NotForSaleEdit-one borderbottom">
      <div class="NotForSaleEdit-title">
        <div></div>
        <div>可撕标示图</div>
      </div>
      <div class="NotForSaleEdit-one-content">
        <div>
          <el-upload
            class="upload-demo"
            drag
            action="https://ssy.13yu.com/index.php/Admin/Api/upload"
            multiple
            :on-success="handleSuccessKSB"
          >
            <i class="el-icon-upload"></i>
            <div class="el-upload__text">
              将文件拖到此处，或<em>点击上传</em>
            </div>
            <div class="el-upload__tip" slot="tip">只能上传jpg/png文件</div>
          </el-upload>
          <div
            v-if="form.tearable_label_img"
            class="filemy-img"
            @mouseover="url = form.tearable_label_img"
            @mouseleave="url = ''"
          >
            <el-image
              :src="form.tearable_label_img"
              fit="cover"
              class="filemy-img-image"
            ></el-image>
            <div class="filemy-img-popup" v-if="url">
              <i
                class="el-icon-zoom-in pointer"
                @click="handlePictureCardPreview({ url: form.tearable_label_img })"
              ></i>
              <i
                class="el-icon-delete pointer"
                v-if="process_sheet_status == 0"
                @click="onImageDeleteKSB()"
              ></i>
            </div>
          </div>
        </div>
      </div>
    </div>
    <process
      :data="form.process_instruction"
      @processComponent="processComponent"
      :disabled="false"
    ></process>
    <div class="NotForSaleEdit-one borderbottom">
      <div class="NotForSaleEdit-title">
        <div></div>
        <div>唛头位置</div>
      </div>
      <div class="classmei">
        <div
          v-for="item in mtPosition"
          :key="item.type"
          class="pointer"
          :style="{
            border: item.type == mttype ? '1px solid #2c70d6' : '',
            color: item.type == mttype ? '#2c70d6' : '',
          }"
          @click="onMtPosition(item)"
        >
          {{ item.title }}
        </div>
      </div>
      <div class="">
        <div style="display: flex; align-items: center">
          <div class="" style="width: 80px; margin-right: 10px">
            {{ mttype == 5 ? "常规腰" : "主唛" }}
          </div>
          <el-input
            style="width: 100%"
            v-model="form.mark_position.main"
            placeholder="请输入"
            size="normal"
            clearable
          ></el-input>
        </div>
      </div>
      <div style="display: flex; align-items: center; margin-top: 10px">
        <div class="" style="width: 80px; margin-right: 10px">
          {{ mttype == 5 ? "牛筋腰" : "洗唛" }}
        </div>
        <el-input
          style="width: 100%"
          v-model="form.mark_position.second"
          placeholder="请输入"
          size="normal"
          clearable
        ></el-input>
      </div>
    </div>
    <div
      class="NotForSaleEdit-one borderbottom"
      v-if="form.sample_clothes_modification_comments"
    >
      <div class="NotForSaleEdit-title">
        <div></div>
        <div>样衣修改意见</div>
      </div>
      <div class="NotForSaleEdit-one-content">
        <el-input
          type="textarea"
          :rows="3"
          v-model="form.sample_clothes_modification_comments"
          placeholder="请输入样衣修改意见"
          size="normal"
          clearable
        ></el-input>
      </div>
    </div>
    <div class="NotForSaleEdit-one borderbottom">
      <div class="NotForSaleEdit-title">
        <div></div>
        <div>锁定要求</div>
        <i
          class="el-icon-circle-plus-outline pointer"
          style="color: #409eff; font-size: 24px; margin-left: 10px"
          @click="onSpecial('requirements_for_locking_nails')"
        ></i>
      </div>
      <div class="">
        <div
          style="display: flex; align-items: center; margin-top: 10px"
          v-for="(item, index) in form.requirements_for_locking_nails"
          :key="index"
        >
          <div class="" style="width: 80px; margin-right: 10px">
            要求{{ index + 1 }}
          </div>
          <el-input
            style="width: 100%"
            v-model="item.title"
            placeholder="请输入内容"
            size="normal"
            clearable
          ></el-input>
          <i
            class="el-icon-delete pointer"
            style="font-size: 30px; color: red; margin-left: 10px"
            @click="onDelete(index, 'requirements_for_locking_nails')"
          ></i>
        </div>
      </div>
    </div>
    <div class="NotForSaleEdit-one borderbottom">
      <div class="NotForSaleEdit-title">
        <div></div>
        <div>特殊工艺要求</div>
        <i
          class="el-icon-circle-plus-outline pointer"
          style="color: #409eff; font-size: 24px; margin-left: 10px"
          @click="onSpecial('special_process_requirements')"
        ></i>
      </div>
      <div class="">
        <div
          style="display: flex; align-items: center; margin-top: 10px"
          v-for="(item, index) in form.special_process_requirements"
          :key="index"
        >
          <div class="" style="width: 80px; margin-right: 10px">
            要求{{ index + 1 }}
          </div>
          <el-input
            style="width: 100%"
            v-model="item.title"
            placeholder="请输入内容"
            size="normal"
            clearable
          ></el-input>
          <i
            class="el-icon-delete pointer"
            style="font-size: 30px; color: red; margin-left: 10px"
            @click="onDelete(index, 'special_process_requirements')"
          ></i>
        </div>
      </div>
    </div>
    <div class="NotForSaleEdit-one borderbottom">
      <div class="NotForSaleEdit-title">
        <div></div>
        <div>包装规格要求</div>
        <i
          class="el-icon-circle-plus-outline pointer"
          style="color: #409eff; font-size: 24px; margin-left: 10px"
          @click="onSpecial('packaging_specification_requirements')"
        ></i>
      </div>
      <div class="">
        <div
          style="display: flex; align-items: center; margin-top: 10px"
          v-for="(item, index) in form.packaging_specification_requirements"
          :key="index"
        >
          <div class="" style="width: 80px; margin-right: 10px">
            要求{{ index + 1 }}
          </div>
          <el-input
            style="width: 100%"
            v-model="item.title"
            placeholder="请输入内容"
            size="normal"
            clearable
          ></el-input>
          <i
            class="el-icon-delete pointer"
            style="font-size: 30px; color: red; margin-left: 10px"
            @click="onDelete(index, 'packaging_specification_requirements')"
          ></i>
        </div>
      </div>
    </div>
    <div class="NotForSaleEdit-one borderbottom">
      <div class="NotForSaleEdit-title">
        <div></div>
        <div>裁剪要求</div>
      </div>
      <div class="NotForSaleEdit-one-content">
        <el-input
          type="textarea"
          :rows="5"
          v-model="form.cutting_requirements"
          placeholder="请输入裁剪要求"
          size="normal"
          clearable
        ></el-input>
      </div>
    </div>
    <div class="NotForSaleEdit-one borderbottom">
      <div class="NotForSaleEdit-title">
        <div></div>
        <div>后道工序</div>
      </div>
      <div class="NotForSaleEdit-one-content">
        <el-input
          type="textarea"
          :rows="5"
          v-model="form.subsequent_process"
          placeholder="请输入后道工序"
          size="normal"
          clearable
        ></el-input>
      </div>
    </div>
    <div class="NotForSaleEdit-one borderbottom">
      <div class="NotForSaleEdit-title">
        <div></div>
        <div>验收标准</div>
      </div>
      <div class="NotForSaleEdit-one-content">
        <el-input
          type="textarea"
          :rows="5"
          v-model="form.acceptance_criteria"
          placeholder="请输入验收标准"
          size="normal"
          clearable
        ></el-input>
      </div>
    </div>
    <!-- <div class="NotForSaleEdit-one borderbottom">
      <div class="NotForSaleEdit-title">
        <div></div>
        <div>生产部补充说明事项</div>
      </div>
      <div class="NotForSaleEdit-one-content">
        <el-input
          type="textarea"
          :rows="5"
          v-model="form.production_department_supplement"
          placeholder="请输入生产部补充说明事项"
          size="normal"
          clearable
        ></el-input>
      </div>
    </div> -->
    <div class="NotForSaleEdit-one borderbottom">
      <div class="NotForSaleEdit-title">
        <div></div>
        <div>绣花推码图</div>
      </div>
      <tmt
        :tm_img="tm_img"
        :type_no="type_no"
        :process_sheet_status="process_sheet_status"
      ></tmt>
    </div>
    <div class="save">
      <el-button
        circle
        type="primary"
        size="default"
        :loading="loading"
        @click="onSave"
        >保 存</el-button
      >
    </div>
    <div class="saveImport">
      <el-button
        circle
        type=""
        size="default"
        @click="dialogVisiblePositionImport = true"
        :loading="loading"
        >导 入</el-button
      >
    </div>
    <div class="savepreview">
      <el-button
        circle
        type=""
        size="default"
        @click="dialogVisiblePositionPreview = true"
        :loading="loading"
        >预 览</el-button
      >
    </div>
    <el-dialog
      :modal="false"
      title="导入"
      :visible.sync="dialogVisiblePositionImport"
      :before-close="handleClosePosition"
    >
      <div class="positionImport">
        <div>
          <div class="star">款号：</div>
          <div>
            <el-input
              v-model="type_noG"
              placeholder="请输入完整的款号"
              size="mini"
              @keyup.enter.native="clickType_no"
            >
              <el-button
                slot="append"
                icon="el-icon-search"
                :disabled="!type_noG"
                @click="clickType_no"
              ></el-button
            ></el-input>
          </div>
        </div>
        <div>
          <div class="">款名：</div>
          <div>
            {{ Type_nodetail.type_name }}
          </div>
        </div>
      </div>
      <div style="color: red; margin-top: 10px; font-size: 12px" class="star">
        注：“已存在的信息”将会被“导入信息”覆盖，请谨慎操作！
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleClosePosition">取 消</el-button>
        <el-button
          type="primary"
          :disabled="!Type_nodetail.type_name"
          @click="clickImportSubmit"
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <el-dialog
      :modal="false"
      title="预览"
      :visible.sync="dialogVisiblePositionPreview"
      :before-close="handleClosePosition"
    >
      <processPDF
        :type_no="form.type_no"
        v-if="dialogVisiblePositionPreview"
      ></processPDF>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleClosePosition">取 消</el-button>
        <el-button type="primary" @click="handleClosePosition">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog :visible.sync="dialogVisibleImage" :modal="false">
      <img width="100%" :src="dialogImageUrl" alt="" />
    </el-dialog>
    <el-collapse class="log" v-if="log_list.length">
      <el-collapse-item title="更新日志" name="1">
        <div v-for="(item, index) in log_list" :key="index">
          {{ item.createtime }}
          {{ item.content }}
        </div>
      </el-collapse-item>
    </el-collapse>
  </div>
</template>

<script>
import {
  postAdminOperateSetProcess_sheet,
  postAdminOperateLookProcess_sheet,
  postAdminOperateProcess_sheet_tuimaing,
} from "@/api";
import process from "./process.vue";
import processPDF from "./processPDF.vue";
import tmt from "./tmt.vue";

export default {
  props: {
    type_no: "",
    process_sheet_status: "",
  },
  components: {
    process,
    processPDF,
    tmt
  },
  data() {
    return {
      dialogVisiblePositionImport: false,
      dialogVisiblePositionPreview: false,
      log_list: [],
      loading: false,
      dialogVisible: false,
      dialogVisibleimg: false,
      dialogVisibleImage: false,
      disabled: false,
      dialogImageUrl: "",
      url:"",
      mttype: "", //当前选中的唛头
      tm_img: [],

      form: {
        type_no: "", //款号
        is_gif: 0,
        is_perform: 0,
        is_shuixi: 0,
        tearable_label_img: "",
        add_user:"",
        production_sewing_process_requirements: {
          stitch: "",
          lining: "",
        }, //生产缝制工艺要求
        particular_attention: [], //特别注意
        detail_drawing: [], //细节图片
        process_instruction: [], //工艺指示书
        mark_position: {
          title: "",
          type: "",
          main: "",
          second: "",
        }, //唛头位置
        sample_clothes_modification_comments: "", //样衣修改意见
        requirements_for_locking_nails: [], //锁钉要求
        special_process_requirements: [
          { title: "绣花处不可跳针 不可起皱 不可跳针，绣花处不可有劈裂现象；" },
          { title: "印花：印花要求清晰 ，位置准确" },
          { title: "按纸样尺寸压褶，褶位均匀，不可炸褶；丝缕顺直" },
        ], //特殊工艺要求
        packaging_specification_requirements: [
          { title: "包装：检验合格，单件折装入袋，挂牌置于正面。" },
        ], //包装规格要求
        cutting_requirements: "", // 裁剪要求
        subsequent_process: "", // 后道工序
        acceptance_criteria: "", // 验收标准
        production_department_supplement: "", //生产部补充说明
      },
      mtPosition: [
        {
          title: "大衣类",
          type: 1,
          main: "主标订与后领贴居中，领口净下2CM处，两端内折边车0.15CM线，左侧居中夹订尺码标",
          second: "洗唛订与里左侧缝底摆净上10CM处，成分朝上，往后倒",
        },
        {
          title: "衬衫/连衣裙类",
          type: 2,
          main: "主标对折夹订与后领圈居中（logo朝上）",
          second: "洗唛订与左侧缝底摆净上10CM处，成分朝上，往后倒",
        },
        {
          title: "对襟衫/比甲类",
          type: 3,
          main: "主标对折夹订与后领圈居中（logo朝上）",
          second: "洗唛订与左侧缝，叉顶净上3CM处",
        },
        {
          title: "吊带类/T恤类",
          type: 4,
          main: "主唛和洗唛重叠订与穿起左侧缝下摆往上10CM处，主唛在上，洗唛在下（成分朝上），往前倒",
          second:
            "主唛和洗唛重叠订与穿起左侧缝下摆往上10CM处，主唛在上，洗唛在下（成分朝上），往前倒",
        },
        {
          title: "裤子/半裙类",
          type: 5,
          main: "主唛对折夹订与里后腰居中（logo朝上）; 洗唛订与左侧缝装腰缝净下6CM处（不含腰），成分朝上，往后倒",
          second:
            "主唛、洗唛重叠订与左侧缝装腰缝净下6CM处，主唛在上、洗唛在下（成分朝上），往后倒",
        },
        {
          title: "马面裙",
          type: 6,
          main: "主标、洗唛重叠夹订与里左后腰居中位（穿计），主唛在上、洗唛在下（成分朝上）",
          second:
            "主标、洗唛重叠夹订与里左后腰居中位（穿计），主唛在上、洗唛在下（成分朝上）",
        },
        {
          title: "褶裙/破裙类",
          type: 7,
          main: "主标对折夹订与后腰居中（logo朝上）",
          second: "洗标订与里后中缝底边净上15CM处（成分朝上）",
        },
      ],
      Type_nodetail: "",
      type_noG: "",
    };
  },
  async mounted() {
    if (this.type_no) {
      this.postAdminOperateLookProcess_sheet(this.type_no);
    }
  },
  methods: {
    handleClosePosition() {
      this.dialogVisiblePositionImport = false;
      this.dialogVisiblePositionPreview = false;
      this.type_noG = "";
      this.Type_nodetail = "";
    },
    async clickImportSubmit() {
      let { form } = this;
      let { Type_nodetail } = this;

      let data = Type_nodetail;
      data.type_no = form.type_no;
      data.type_name = form.type_name;
      data.add_user = form.add_user
      data.wear_image = form.wear_image;
      let formobj = Object.assign(form, data);
      this.log_list = formobj.log_list;
      formobj.production_sewing_process_requirements =
        formobj.production_sewing_process_requirements || {
          stitch: `1/明线/内拼合针距 3CM/14针； 
2/拷边线针距：3CM/18针3/ 面线用配色线40S/2，底线用配色40S/2线。（整件使用配色细线制作)`,
          lining: "",
        };
      if (
        formobj.production_sewing_process_requirements &&
        !formobj.production_sewing_process_requirements.stitch
      ) {
        formobj.production_sewing_process_requirements.stitch = `1/明线/内拼合针距 3CM/14针； 
2/拷边线针距：3CM/18针3/ 面线用配色线40S/2，底线用配色40S/2线。（整件使用配色细线制作)`;
      }
      formobj.wear_image = formobj.wear_image || [];
      formobj.particular_attention = formobj.particular_attention || [];
      formobj.detail_drawing = formobj.detail_drawing || [];
      formobj.process_instruction = formobj.process_instruction || [];
      formobj.particular_attention = formobj.particular_attention || [];
      if (formobj.mark_position) {
        this.mttype = formobj.mark_position.type;
      }
      formobj.mark_position = formobj.mark_position || {
        title: "",
        type: "",
        main: "",
        second: "",
      };
      formobj.requirements_for_locking_nails =
        formobj.requirements_for_locking_nails || [];
      formobj.special_process_requirements =
        formobj.special_process_requirements || [
          { title: "绣花处不可跳针 不可起皱 不可跳针，绣花处不可有劈裂现象；" },
          { title: "印花：印花要求清晰 ，位置准确" },
          { title: "按纸样尺寸压褶，褶位均匀，不可炸褶；丝缕顺直" },
        ];
      formobj.packaging_specification_requirements =
        formobj.packaging_specification_requirements || [
          { title: "包装：检验合格，单件折装入袋，挂牌置于正面。" },
        ];
      formobj.acceptance_criteria =
        formobj.acceptance_criteria ||
        `1.面料:无线头，无污渍、无油渍、无破洞、无色差、无粉迹。 
2.线迹:针距达标，宽窄一致，线迹顺直，平服，全件无浮线、跳针、脱线、滑线、等现象。 
3.整烫：成品各部位整烫平服、自然， 无污迹、极光、等现象。 
4.包装:总检合格后进行包装，折叠平服，吊牌挂好，带条形码的一面朝上。
`;
      formobj.subsequent_process =
        formobj.subsequent_process ||
        `1.锁眼+订扣：对照样衣，按样板点位，按扣子大小，锁扣眼
2.手工订扣，纽扣反面按样衣效果订底扣，完成扣子扣眼要吻合，扣眼不可有线毛。
3.整烫：整烫自然平整，无极光，无印痕，无起皱。                                            
4.检验：按工艺要控制各部位尺寸，线头清理干净，保持成衣整洁。
`;
      formobj.cutting_requirements =
        formobj.cutting_requirements ||
        `1.针织、弹性面料要提前24小时松布。排料放松布料对条纹 
2.排料前检查面料有无缩率、门幅大小、倒顺、正反面、疵点、边道色差 
3.裁前核对样板正确无误，裁剪时刀眼不得深于0.3cm。 
4.大货前封一件产前样到公司确认，确认合格后才可生产大货。
`;
      delete formobj.log_list;
      this.form = formobj;
      this.handleClosePosition();
    },
    handleSuccessCY(response) {
      let { wear_image } = this.form;
      let obj = {
        name: "图片",
        url: response.img,
      };
      wear_image.push(obj);
      this.form.wear_image = wear_image;
    },
    async clickType_no() {
      let obj = {
        type_no: this.type_noG,
      };
      let res = await postAdminOperateLookProcess_sheet(obj);
      this.Type_nodetail = res.data;
    },

    handleRemove(file) {},
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisibleImage = true;
    },
    onMtPosition(e) {
      let { mttype, form } = this;
      let { mark_position } = form;
      if (e.type != mttype) {
        this.mttype = e.type;
        mark_position = e;
        this.form.mark_position = mark_position;
      }
    },
    handleSuccess(response, index) {
      let { particular_attention } = this.form;
      particular_attention[index].url = response.img;
      this.form.particular_attention = particular_attention;
    },
    handleSuccessXJ(response) {
      let { detail_drawing } = this.form;
      let obj = {
        name: "图片",
        url: response.img,
      };
      detail_drawing.push(obj);
      console.log("detail_drawing", detail_drawing);
      this.form.detail_drawing = detail_drawing;
    },
    handleSuccessKSB(response) {
      this.form.tearable_label_img = response.img;
    },
    async andleSuccessTMT(response) {
      let { tm_img, type_no } = this;
      tm_img.push(response.img);
      this.tm_img = tm_img;
      let obj = {
        type_no,
        tm_img,
      };
      await postAdminOperateProcess_sheet_tuimaing(obj);
    },
    onDelete(index, key) {
      let { form } = this;
      this.$confirm("确定删除?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        form[key].splice(index, 1);
        particular_attention.splice(index, 1);
        this.form = form;
      });
    },
    onImageDeleteKSB(){
      this.form.tearable_label_img = ""
      this.url = ""
    },
    onSpecial(key) {
      let { form } = this;
      let obj = {};
      if (key == "particular_attention") {
        obj = {
          content: "",
          url: "",
        };
      } else {
        obj = {
          title: "",
        };
      }
      form[key].push(obj);
      this.form = form;
    },
    handleRemovesXJ(file) {
      let { detail_drawing } = this.form;
      let index = detail_drawing.findIndex((e) => e.url == file.url);
      detail_drawing.splice(index, 1);
      this.form.detail_drawing = detail_drawing;
      return true;
    },
    async postAdminOperateLookProcess_sheet(type_no) {
      let { form } = this;
      let obj = {
        type_no,
      };
      let res = await postAdminOperateLookProcess_sheet(obj);

      let formobj = Object.assign(form, res.data);
      this.tm_img = formobj.tm_img || [];
      this.log_list = formobj.log_list;
      formobj.tearable_label_img = formobj.tearable_label_img || "";
      formobj.production_sewing_process_requirements =
        formobj.production_sewing_process_requirements || {
          stitch: `1/明线/内拼合针距 3CM/14针； 
2/拷边线针距：3CM/18针3/ 面线用配色线40S/2，底线用配色40S/2线。（整件使用配色细线制作)`,
          lining: "",
        };
      if (
        formobj.production_sewing_process_requirements &&
        !formobj.production_sewing_process_requirements.stitch
      ) {
        formobj.production_sewing_process_requirements.stitch = `1/明线/内拼合针距 3CM/14针； 
2/拷边线针距：3CM/18针3/ 面线用配色线40S/2，底线用配色40S/2线。（整件使用配色细线制作)`;
      }
      formobj.wear_image = formobj.wear_image || [];
      formobj.particular_attention = formobj.particular_attention || [];
      formobj.detail_drawing = formobj.detail_drawing || [];
      formobj.process_instruction = formobj.process_instruction || [];
      formobj.particular_attention = formobj.particular_attention || [];
      if (formobj.mark_position) {
        this.mttype = formobj.mark_position.type;
      }
      formobj.mark_position = formobj.mark_position || {
        title: "",
        type: "",
        main: "",
        second: "",
      };
      formobj.requirements_for_locking_nails =
        formobj.requirements_for_locking_nails || [];
      formobj.special_process_requirements =
        formobj.special_process_requirements || [
          { title: "绣花处不可跳针 不可起皱 不可跳针，绣花处不可有劈裂现象；" },
          { title: "印花：印花要求清晰 ，位置准确" },
          { title: "按纸样尺寸压褶，褶位均匀，不可炸褶；丝缕顺直" },
        ];
      formobj.packaging_specification_requirements =
        formobj.packaging_specification_requirements || [
          { title: "包装：检验合格，单件折装入袋，挂牌置于正面。" },
        ];
      formobj.acceptance_criteria =
        formobj.acceptance_criteria ||
        `1.面料:无线头，无污渍、无油渍、无破洞、无色差、无粉迹。 
2.线迹:针距达标，宽窄一致，线迹顺直，平服，全件无浮线、跳针、脱线、滑线、等现象。 
3.整烫：成品各部位整烫平服、自然， 无污迹、极光、等现象。 
4.包装:总检合格后进行包装，折叠平服，吊牌挂好，带条形码的一面朝上。
`;
      formobj.subsequent_process =
        formobj.subsequent_process ||
        `1.锁眼+订扣：对照样衣，按样板点位，按扣子大小，锁扣眼
2.手工订扣，纽扣反面按样衣效果订底扣，完成扣子扣眼要吻合，扣眼不可有线毛。
3.整烫：整烫自然平整，无极光，无印痕，无起皱。                                            
4.检验：按工艺要控制各部位尺寸，线头清理干净，保持成衣整洁。
`;
      formobj.cutting_requirements =
        formobj.cutting_requirements ||
        `1.针织、弹性面料要提前24小时松布。排料放松布料对条纹 
2.排料前检查面料有无缩率、门幅大小、倒顺、正反面、疵点、边道色差 
3.裁前核对样板正确无误，裁剪时刀眼不得深于0.3cm。 
4.大货前封一件产前样到公司确认，确认合格后才可生产大货。
`;
      formobj.is_gif = formobj.is_gif || "0";
      formobj.is_perform = formobj.is_perform || "0";
      formobj.is_shuixi = formobj.is_shuixi || "0";

      console.log("formobj", formobj);
      delete formobj.log_list;
      this.form = formobj;
    },
    processComponent(data) {
      console.log("data--->", data);
      let { form } = this;
      form.process_instruction = data;
      this.form = form;
    },
    async onSave() {
      let { form } = this;
      console.log("form", form);
      let formObj = JSON.parse(JSON.stringify(form));
      delete formObj.wear_image;
      delete formObj.updatetime;
      delete formObj.createtime;
      this.loading = true;
      try {
        await postAdminOperateSetProcess_sheet(formObj);
        this.loading = false;
        this.$message.success("保存成功");
      } catch (error) {
        this.loading = false;
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.upload-demo {
    /deep/ .el-upload-list {
        display: none;
    }
    /deep/ .el-upload-dragger{
        width:240px;
        height: 150px;
    }
}
.filemy-img {
  margin-left: 10px;
  position: relative;

  .filemy-img-image {
    width: 100px;
    height: 100px;
    margin-right: 20px;
  }

  .filemy-img-popup {
    width: 100px;
    height: 100px;
    position: absolute;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba($color: #000000, $alpha: 0.3);
    color: #ffffff;
    font-size: 20px;

    > i {
      margin: 5px;
    }
  }
}
.positionImport {
  display: flex;

  > div {
    display: flex;
    align-items: center;
    margin-right: 40px;

    > div:nth-child(1) {
      width: 60px;
    }
  }
}

.save {
  position: absolute;
  top: 30px;
  right: 100px;
  z-index: 10;

  > .el-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  }
}

.saveImport {
  position: absolute;
  top: 100px;
  right: 100px;
  z-index: 10;

  > .el-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  }
}

.savepreview {
  position: absolute;
  top: 170px;
  right: 100px;
  z-index: 10;

  > .el-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  }
}

.log {
  background: #ffffff;
  left: 60px;
  padding: 0 20px;
  position: fixed;
  bottom: 0;
  width: calc(100% - 120px);
}

.classmei {
  display: flex;
  margin-bottom: 20px;

  > div {
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    padding: 6px 20px;
    margin-right: 20px;
  }
}

.plus {
  width: 100%;
  text-align: center;
  height: 60px;
  line-height: 60px;
  font-size: 30px;
  border: 1px solid #ebeef5;
  border-top: none;
}

.borderbottom {
  border-bottom: 1px solid #efefef;
  padding-bottom: 20px;
  margin-bottom: 20px;
}

.NotForSaleEdit {
  background: #ffffff;
  padding: 20px;
  border-radius: 8px;

  .NotForSaleEdit-title {
    display: flex;
    align-items: center;
    font-size: 20px;
    font-weight: 800;
    padding-bottom: 20px;

    > div:nth-child(1) {
      width: 4px;
      height: 26px;
      border-radius: 4px;
      background: #409eff;
      margin-right: 10px;
    }
  }

  .NotForSaleEdit-one {
    .NotForSaleEdit-one-content {
      .NotForSaleEdit-one-content-items {
        display: flex;
        align-items: center;
      }

      > div {
        display: flex;
        align-items: center;
        margin-bottom: 20px;

        > div:nth-child(2) {
          display: flex;
          align-items: center;
        }
      }
    }

    .NotForSaleEdit-one-position {
      display: flex;
      align-items: center;

      > div {
        display: flex;
        align-items: center;
        margin-bottom: 20px;

        > div:nth-child(1) {
          width: 140px;
          text-align: right;
          margin-right: 10px;
        }

        > .el-input {
          width: 400px;
        }

        > div:nth-child(2) {
          display: flex;
          align-items: center;
        }
      }
    }
  }

  .NotForSaleEdit-two {
    .NotForSaleEdit-two-content {
      display: flex;
      flex-wrap: wrap;

      > div {
        display: flex;
        align-items: center;
        margin-bottom: 20px;

        > div:nth-child(1) {
          width: 140px;
          text-align: right;
          margin-right: 10px;
        }

        /deep/ .el-input {
          width: 400px;
        }
      }
    }
  }
}
</style>